﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:k="clr-namespace:personalplaner.common.themes">

    <!-- 
    *****************************************************************
    Brushes for common styles 
    *****************************************************************
    -->
    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="/personalplaner.common;component/resources/CommonBrushes.xaml"/>
    </ResourceDictionary.MergedDictionaries>

    <!-- 
    *****************************************************************
    Style templates 
    *****************************************************************
    -->
    
    <!--
    *****************************************************************
    Style for images. Sets the transparency of the image to 50% if the button containing it is disabled
    Small workaround to display disabled images in buttons
    
    Usage:
    <Button Style="{StaticResource TransparentButtonStyle}">
         <Image Source="\resources\images\Icon.Check.ico" Style="{StaticResource ButtonImageStyle}"/>
    </Button>
    *****************************************************************
    -->
    <Style x:Key="ButtonImageStyle" TargetType="{x:Type Image}" >
        <Style.Triggers>
            <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType={x:Type Button}, AncestorLevel=1}, Path=IsEnabled}" Value="False">
                <Setter Property="Opacity" Value="0.50"></Setter>
            </DataTrigger>
        </Style.Triggers>
    </Style>

    <!--
    *****************************************************************
    Style for path objects. Sets the transparency of the image to 50% if the button containing it is disabled
    Small workaround to display disabled images in buttons
    *****************************************************************
    -->
    <Style x:Key="ButtonPathStyle" TargetType="{x:Type Path}" >
        <Style.Triggers>
            <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType={x:Type Button}, AncestorLevel=1}, Path=IsEnabled}" Value="False">
                <Setter Property="Opacity" Value="0.50"></Setter>
            </DataTrigger>
        </Style.Triggers>
    </Style>

    <!--
    *****************************************************************
    Style for line objects. Sets the transparency of the image to 50% if the button containing it is disabled
    Small workaround to display disabled images in buttons
    *****************************************************************
    -->
    <Style x:Key="ButtonLineStyle" TargetType="{x:Type Line}" >
        <Style.Triggers>
            <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType={x:Type Button}, AncestorLevel=1}, Path=IsEnabled}" Value="False">
                <Setter Property="Opacity" Value="0.50"></Setter>
            </DataTrigger>
        </Style.Triggers>
    </Style>

    <!--
    *****************************************************************
    Style for for Buttons that are transparent.
    Only the content that is defined is visible.
    
    Usage:
    <Button Style="{StaticResource TransparentButtonStyle}">
         <TextBlock Text="Ok"/>
    </Button>
    Only the TestBlock is visible.
    *****************************************************************
    -->
    <Style x:Key="TransparentButtonStyle" TargetType="{x:Type Button}">
        <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Button}">
                    <Border 
						x:Name="PaneHeaderCommandIntBorder" 
						Background="Transparent"
                        BorderBrush="Transparent"
						Margin="0"
						Opacity="0.8">
                        <ContentPresenter ContentSource="Content" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="BoarderedButtonStyle" TargetType="{x:Type Button}">
        <Setter Property="BorderBrush" Value="Gray"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Button}">
                    <Border 
						x:Name="PaneHeaderCommandIntBorder" 
						Background="Transparent"
                        BorderBrush="{TemplateBinding BorderBrush}"
						BorderThickness="1"
                        CornerRadius="1"
						Margin="0"
						Opacity="0.8">
                        <ContentPresenter ContentSource="Content"/>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter Property="BorderBrush" 
								TargetName="PaneHeaderCommandIntBorder"
								Value="Black"/>
                            <Setter Property="Background" 
								TargetName="PaneHeaderCommandIntBorder"
								Value="LightGray"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>